<?php

class primitiveTypes {
	
	function string($var) {
		if (is_string ( $var )) {
			return true;
		} else {
			//return false;
			$error = "";
			if (gettype ( $var ) == "object") {
				$error = "instance of " . get_class ( $var );
			} else {
				$error = gettype ( $var );
			}
			throw new Exception ( "\n\nValue expected to be " . __FUNCTION__ . " but \nis " . $error . "\n\n" );
		}
	}
	
	function int($var) {
		if (is_int ( $var )) {
			return true;
		} else {
			//return false;
			$error = "";
			if (gettype ( $var ) == "object") {
				$error = "instance of " . get_class ( $var );
			} else {
				$error = gettype ( $var );
			}
			throw new Exception ( "\n\nValue expected to be " . __FUNCTION__ . " but \nis " . $error . "\n\n" );
		}
	}
	
	function long($var) {
		if (is_long ( $var )) {
			return true;
		} else {
			//return false;
			$error = "";
			if (gettype ( $var ) == "object") {
				$error = "instance of " . get_class ( $var );
			} else {
				$error = gettype ( $var );
			}
			throw new Exception ( "\n\nValue expected to be " . __FUNCTION__ . " but \nis " . $error . "\n\n" );
		}
	}

}

?>